home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Utilities / Miscellaneous / CopyPaste 3.3.4 / CopyPaste Tools Sourcecode / Lowercase / Lowercase.p < prev    next >
Encoding:
Text File  |  1997-06-06  |  1.8 KB  |  77 lines  |  [TEXT/CWIE]

  1. {•This sourcecode is an example for creating a FKey coderesource with•}
  2. {•Metrowerks Pascal. It is copyrighted by Peter Hoerster and released•}
  3. {•for free use in any Shareware or Freeware product as a way to thank all•}
  4. {•programmers who share code snippets. You may put this sources on any•}
  5. {•CD ROM or any Archive Server but you may not sell it. •}
  6.  
  7. {• For comments please write to <hoerster@muenster.de>•}
  8.  
  9.  
  10. unit Lowercase;
  11.  
  12. interface
  13.  
  14.     uses
  15.         Types, OSUtils, GestaltEqu, Script, notification, Resources, Events,
  16.          PascalA4, QuickDraw, ToolUtils, Memory, LowMem, Scrap;
  17.  
  18.  
  19.  
  20. {$MAIN}
  21.                         
  22.     procedure main;        
  23.  
  24. implementation
  25.  
  26. procedure dopaste;
  27.     const
  28.         pastecode=2422;
  29.     var 
  30.         qel: EvQelPtr;
  31.     begin
  32.             if ppostevent(3, pastecode, qel) = noerr then
  33.             qel^.evtqmodifiers := cmdkey;
  34.     end;
  35.  
  36.     procedure main;
  37.         const
  38.         step = 1000;
  39.  
  40.         var
  41.             oldA4: LongInt;
  42.             myerr: oserr;
  43.             myclipsize, templongint, count, pos,rest,i,amount: longint;
  44.             myclipHandle: handle;
  45.     begin
  46.         oldA4 := SetCurrentA4;
  47.         myclipsize := GetScrap(nil, 'TEXT', templongint);
  48.         mycliphandle := Tempnewhandle(myclipsize,myerr);
  49.         if myerr=noerr then 
  50.             begin
  51.                 myclipsize := GetScraP(myclipHandle, 'TEXT', templongint);
  52.                 if myclipsize > 0 then
  53.                     begin
  54.                         pos:=0;
  55.                         count:=myclipsize div step;
  56.                         rest:=myclipsize mod step;
  57.                         Temphlock(mycliphandle,myerr);
  58.                         if myerr=noerr then 
  59.                             begin
  60.                                 for i := 1 to count do
  61.                                     begin
  62.                                         amount := step;
  63.                                         lowertext(Ptr(ord4(myclipHandle^)+pos), amount);
  64.                                         pos := i * step;
  65.                                     end;    
  66.                                 lowertext(Ptr(ord4(myclipHandle^)+pos), rest);            
  67.                                 myerr := ZeroScrap;
  68.                                 myerr := putscrap(myclipsize, 'TEXT', myclipHandle^);
  69.                                 dopaste;
  70.                             end;
  71.                         Temphunlock(myCliphandle,myerr);
  72.                     end;
  73.             end;
  74.         TempDisposeHandle(myCliphandle,myerr);
  75.         oldA4 := SetA4(oldA4);
  76.     end;
  77. end.